# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=mblaze
pkgver=0.7
pkgrel=0
pkgdesc="Unix utilities to deal with Maildir"
url="https://github.com/chneukirchen/mblaze"
arch="all"
license="CC0-1.0"
checkdepends="perl-utils"
subpackages="$pkgname-doc $pkgname-crypto::noarch"
options="!check" # currently fail on the builder
source="$pkgname-$pkgver.tar.gz::https://github.com/chneukirchen/mblaze/archive/v$pkgver.tar.gz"

build() {
	make CFLAGS="$CFLAGS" -C "$builddir"
}

check() {
	make -C "$builddir" check
}

package() {
	make PREFIX="/usr" DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/examples/
	install -m644 *.example "$pkgdir"/usr/share/doc/$pkgname/examples/
	install -m644 NEWS.md VIOLATIONS.md README \
		"$pkgdir"/usr/share/doc/$pkgname/
}

crypto() {
	depends="openssl gnupg"
	pkgdesc="Scripts for using S/MIME and PGP"

	cd "$builddir/contrib"
	mkdir -p "$subpkgdir"/usr/bin
	install -m755 mverify msign mencrypt mgpg \
		"$subpkgdir"/usr/bin
}

sha512sums="aceac5526c64f1173f2b59a7a0367251ac8117230e4264d0d8d918c5353ae13d90a3156154b5322ba5276d46dac38518e3ff4a0ef6643bdff4c3d7046e52a685  mblaze-0.7.tar.gz"
